#include "c10_T1_bank.h"
#include <iostream>

//constructor
BankAccount::BankAccount()  //default constructor 
{
	name = "no name";
	acctnum = "******";
	balance = 0.0;
}

BankAccount::BankAccount(const std::string &client, const std::string &num, double bal)
{
	name = client;
	acctnum = num;
	balance = bal;
}

BankAccount::~BankAccount()  //destructor
{
	std::cout << "Bye!\n";
}

void BankAccount::show() const
{
	using std::cout;
	using std::endl;
	cout << "Client Name : " << name << endl;
	cout << "Account Number : #" << acctnum << " Balance : $" << balance << endl;
}

void BankAccount::deposit(double cash)
{
	if (cash < 0)
		std::cout << "Negtive input. \n" << "Transaction is aborted. \n";
	else
		balance += cash;
}

void BankAccount::withdraw(double cash)
{
	if (cash < 0)
		std::cout << "Negtive input. \n" << "Transaction is aborted. \n";
	else
		balance -= cash;
}